<template>
	<view class="main" >
		<view class="form">
			<view class="list">
				<i class="iconfont icon-youjian"></i><input type="text" v-model="phone" placeholder="请输入手机号">
			</view>
			<view class="list">
				<i class="iconfont icon-mima"></i><input type="password"  v-model="pwd" placeholder="请输入密码">
			</view>
			<view class="nav">
				<navigator url="../forget/forget">找回密码</navigator>
			</view>
			<view class="btn" @click="handlogin">
				登录
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				phone: '',
				pwd: '',
			};
		},
		methods: {
			handlogin() {
				global.$http.request({
					url: '/api/rider_login/login',
					data: {
						phone: this.phone,
						pwd: this.pwd,
					}
				}).then(res => {
					if (res.data.code == 0) {
						uni.showToast({
							title: res.data.msg,
							icon: "none",
							mask: true,
							duration: 1000
						})
						uni.setStorageSync('token', res.data.data.token);
						uni.setStorageSync('userInfo', JSON.stringify(res.data.data));
						setTimeout(function() {
							uni.switchTab({
								url:'../../indexs/index/index'
							})
						}, 1000)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		
		.main{
			width: 750rpx;
			height: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: space-between;
			.form{
				width: 600rpx;
				height: 600rpx;
				margin-top: 40%;
				background: #FFFFFF;
				border-radius: 20rpx;
				box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(116, 116, 116, 0.3);
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				.list{
					width: 400rpx;
					height: 76rpx;
					border: 2rpx solid #1DBE61;
					border-radius: 38rpx;
					margin-top: 55rpx;
					display: flex;align-items: center;padding:0 20rpx;
					.iconfont{
						margin: 0 5rpx;
						width: 40rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						font-size:30rpx;
						flex-shrink: 0;
					}
					input{
						width: 100%;
					}
				}
				.nav{
					width: 400rpx;
					margin-top: 20rpx;
					display: flex;
					flex-direction: row-reverse;
					font-size: 26rpx;
					color: #808080;
				}
				.btn{
					width: 464rpx;
					height: 60rpx;
					background: #1DBE61;
					border-radius: 30rpx;
					font-size: 32rpx;
					color: #fff;
					display: flex;
					align-items: center;
					justify-content: center;
					margin-top: 165rpx;
				}
			}
		}
		
}
</style>
